﻿/*******************************************************************************
 * Copyright © 2017 FriendStar.Framework 版权所有
 * Author: FZH
 * Description: FriendStar快速开发平台
 * Website：http://www.FriendStar.cn
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using SqlSugarRepository;
using FriendStar.Code;
using FriendStar.Domain.Entity.BOM;
using FriendStar.Domain.IRepository.BOM;
using FriendStar.Repository.BOM;

namespace FriendStar.Application.BOM
{
    /// <summary>
	/// 数据视图 V_CLDE_31_TC_CLDEerialCombine 对应的数据应用功能类。
	/// </summary>
	public class V_CLDE_31_TC_CLDEerialCombineApp
    {       
        private string UseUnit = Configs.GetValue("UseUnit");  

        private IV_CLDE_31_TC_CLDEerialCombineRepository service = new V_CLDE_31_TC_CLDEerialCombineRepository();

        public List<V_CLDE_31_TC_CLDEerialCombineEntity> GetList(Pagination pagination, string keyword)
        {
            var expression = ExtLinq.True<V_CLDE_31_TC_CLDEerialCombineEntity>();
            expression = expression.And(t => t.UseUnit == UseUnit);
            if (!string.IsNullOrEmpty(keyword))
            {
                expression = expression.And(t => t.CombineNO.Contains(keyword));
            }
            return service.FindList(expression, pagination);
        }

        public List<V_CLDE_31_TC_CLDEerialCombineEntity> GetListByNo(Pagination pagination, string CombineNO)
        {
            var expression = ExtLinq.True<V_CLDE_31_TC_CLDEerialCombineEntity>();
            expression = expression.And(t => t.UseUnit == UseUnit);
            expression = expression.And(t => t.CombineNO == CombineNO);
            return service.FindList(expression, pagination);
        }

        public V_CLDE_31_TC_CLDEerialCombineEntity GetItem(string number)
        {
            var expression = ExtLinq.True<V_CLDE_31_TC_CLDEerialCombineEntity>();
            expression = expression.And(t => t.CombineID == number);
            return service.FindEntity(expression);
        }

        public V_CLDE_31_TC_CLDEerialCombineEntity GetForm(string keyValue)
        {
            return service.FindEntity(keyValue);
        }
    }
}